using System;
using System.ComponentModel;
using System.Transactions;

using SIS.ENT;
using SIS.DAL;


namespace SIS.BLL {

/// <summary>
/// The UserProfileTableManager class is responsible for managing BO.UserProfileTable objects in the system.
/// </summary>
[DataObjectAttribute()]
public class UserProfileTableManager
  {

#region "Public Methods"

/// <summary>
/// Gets a list with all UserProfileTable objects in the database.
/// </summary>
/// <returns>A list with all UserProfileTable from the database when the database contains any, or null otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, true)]
public static UserProfileTableList GetList(){
return UserProfileTableDB.GetList();
}

/// <summary>
/// Gets a single UserProfileTable from the database without its data.
/// </summary>
/// <param name="userProfileKey">The UserProfileKey of the UserProfileTable in the database.</param>
/// <returns>A UserProfileTable object when the UserProfileKey exists in the database, or <see langword="null"/> otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static UserProfileTable GetItem(int userProfileKey){
return GetItem(userProfileKey, false);
}

/// <summary>
/// Gets a single UserProfileTable from the database.
/// </summary>
/// <param name="userProfileKey">The UserProfileKey of the UserProfileTable in the database.</param>
/// <param name="getUserProfileTableRecords">Determines whether to load all associated UserProfileTable records as well.</param>
/// <returns>
/// A UserProfileTable object when the UserProfileKey exists in the database, or <see langword="null"/> otherwise.
/// </returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static UserProfileTable GetItem(int userProfileKey, bool getUserProfileTableRecords){
UserProfileTable myUserProfileTable = UserProfileTableDB.GetItem(userProfileKey);
return myUserProfileTable;
}

/// <summary>
/// Saves a UserProfileTable in the database.
/// </summary>
/// <param name="myUserProfileTable">The UserProfileTable instance to save.</param>
/// <returns>The new UserProfileKey if the UserProfileTable is new in the database or the existing UserProfileKey when an item was updated.</returns>
[DataObjectMethod(DataObjectMethodType.Update, true)]
public static int Save(UserProfileTable myUserProfileTable){
using (TransactionScope myTransactionScope = new TransactionScope()){
int userProfileTableUserProfileKey = UserProfileTableDB.Save(myUserProfileTable);

//  Assign the UserProfileTable its new (or existing UserProfileKey).
myUserProfileTable.UserProfileKey = userProfileTableUserProfileKey;

myTransactionScope.Complete();

return userProfileTableUserProfileKey;
}
}

/// <summary>
/// Deletes a UserProfileTable from the database.
/// </summary>
/// <param name="myUserProfileTable">The UserProfileTable instance to delete.</param>
/// <returns>Returns true when the object was deleted successfully, or false otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Delete, true)]
public static bool Delete(UserProfileTable myUserProfileTable){
return UserProfileTableDB.Delete(myUserProfileTable.UserProfileKey);
}

#endregion

}

}
